import Vue from 'vue'
import VueRouter from 'vue-router'
import Main from '../views/Main.vue'
import Login from '../views/Login.vue'
import CategoryEdit from '../views/CategoryEdit.vue'
import CategoryList from '../views/CategoryList.vue'
import ItemEdit from '../views/ItemEdit.vue'
import ItemList from '../views/ItemList.vue'
import HeroEdit from '../views/HeroEdit.vue'
import HeroList from '../views/HeroList.vue'
import ArticleEdit from '../views/ArticleEdit.vue'
import ArticleList from '../views/ArticleList.vue'
import AdvertiseEdit from '../views/AdvertiseEdit.vue'
import AdvertiseList from '../views/AdvertiseList.vue'
import AdminUserEdit from '../views/AdminUserEdit.vue'
import AdminUserList from '../views/AdminUserList.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: Login
  },

  {
    path: '/',
    name: 'main',
    component: Main,
    children: [
      // 分类
      {
        path: '/categories/create',
        component: CategoryEdit,
      },
      {
        path: '/categories/edit/:id',
        component: CategoryEdit,
        props: true
      },
      {
        path: '/categories/list',
        component: CategoryList
      },

      // 物品
      {
        path: '/items/create',
        component: ItemEdit,
      },
      {
        path: '/items/edit/:id',
        component: ItemEdit,
        props: true
      },
      {
        path: '/items/list',
        component: ItemList
      },

      // 英雄
      {
        path: '/heroes/create',
        component: HeroEdit,
      },
      {
        path: '/heroes/edit/:id',
        component: HeroEdit,
        props: true
      },
      {
        path: '/heroes/list',
        component: HeroList
      },

      // 文章
      {
        path: '/articles/create',
        component: ArticleEdit,
      },
      {
        path: '/articles/edit/:id',
        component: ArticleEdit,
        props: true
      },
      {
        path: '/articles/list',
        component: ArticleList
      },

      // 广告位
      {
        path: '/ads/create',
        component: AdvertiseEdit,
      },
      {
        path: '/ads/edit/:id',
        component: AdvertiseEdit,
        props: true
      },
      {
        path: '/ads/list',
        component: AdvertiseList
      },

      // 管理员
      {
        path: '/admin_users/create',
        component: AdminUserEdit,
      },
      {
        path: '/admin_users/edit/:id',
        component: AdminUserEdit,
        props: true
      },
      {
        path: '/admin_users/list',
        component: AdminUserList
      },

    ]
  },


]

const router = new VueRouter({
  routes
})

export default router
